<?php
require_once "Common/database.php";
require_once "Common/values.php";

$result = mysql_query("SELECT * FROM tblUsers WHERE Name='$user'");
$row = mysql_fetch_array($result);


echo '<div id="helpdeskmenu" style="display:none; position:absolute; left:122px; top:25px;">';
 if($row[h]>0)
{
 echo'<table class="topmenu" cellpadding="1" style="font-weight: bold;">
        <tr class="topmenu"><td class="topmenu" onclick="location=\'index.php?p=hnew\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:3%;">New job</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'index.php?p=hmy\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:20%;">Jobs</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'index.php?p=hsearchau\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:35%;">Search</div></td></tr>
         <tr><td class="topmenu" onclick="location=\'index.php?p=kb\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:53%;">KB</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'index.php?p=events\'"><img src="img/menutd.png"><div style=" position:absolute; left:11%; top:70%;">Events</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'index.php?p=stats\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:85%;">Stats</div></td></tr>
    </table>';
}
echo '</div>';

echo '<div id="inventorymenu" style="display:none; position:absolute; left:243px; top:25px;">';
if($row[i]>0)
{
    echo '<table  cellpadding="1" style="font-weight: bold;">
        
        <tr><td class="topmenu" onclick="location=\'index.php?p=iadd\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:5%;">New</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'index.php?p=iview\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:30%;">View</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'index.php?p=loview\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:55%;">Loan</div></td></tr>
        <tr><td class="topmenu" onclick="location=\''.$lansweeper.'\'"><img src="img/menutd.png"><div style="position:absolute; left:11%; top:80%;">lansweeper</div></td></tr>
        
    </table>';
}
echo '</div>';

echo '<div id="systemmenu" style="display:none; position:absolute; left:365px; top:25px;">';

if($row[s]>0)
{
    echo '<table cellpadding="1"  style="font-weight: bold;">


         <tr> <td class="topmenu" onclick="location=\'index.php?p=shview\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:5%;">Helpdesk admin</div></td></tr>
         <tr><td class="topmenu" onclick="location=\'index.php?p=sinventory\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:20%;">Inventory admin</div></td></tr>
         <tr><td class="topmenu" onclick="location=\'index.php?p=lview\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:38%;">Links admin</div></td></tr>
         <tr><td class="topmenu" onclick="window.open(\'/phpmyadmin\',\'phpmyadmin\')"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:55%;">PHPMyAdmin</div></td></tr>
         <tr><td class="topmenu" onclick="location=\'index.php?p=susers\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:72%;">Users</div></td></tr>
         <tr><td class="topmenu" onclick="location=\'index.php?p=settings\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:87%;">System settings</div></td></tr>
         
        
    </table></div>';
}
echo '</div>';

echo '<div id="linksmenu" style="display:none; position:absolute; left:0%; top:25px;">';
if($row[a]>0)
{
echo '<table cellpadding="3" bgcolor="#ffffff" style="font-weight: bold; width:113px;">

<tr><td id="linksdropdown" style="display: block; border : 1px solid #000000;"><table style="font-weight: bold; width:113px;">';
$result = mysql_query("SELECT * FROM tblFolders Order By `key`");
while($row = mysql_fetch_array($result))
{
    echo '<tr><td style="border : 1px solid #000000; color : black;" onclick="linksSelect('.$row[Folder].');">'.$row[Folder].'</td></tr>';
}

echo '</table></td></tr></form>';

$result = mysql_query("SELECT * FROM tblFolders Order By `key`");
while($row = mysql_fetch_array($result))
{
    echo '<tr id="'.$row[Folder].'" style="display:none;" ><td class="topmenu"><table class="topmenu">';

$result1 = mysql_query("SELECT * FROM tblLinks WHERE Folder='$row[Folder]' Order By `key`");
while($row1 = mysql_fetch_array($result1))
{
echo '<tr class="topmenu"><td class="topmenu"><a href='.$row1[Link].'>'.$row1[Name].'</td></tr>';
}


    echo '</table></td></div></tr>';
}

echo '</table>';
}
echo '</div>';

echo '<div id="othermenu" style="display:none; position:absolute; left:488px; top:25px;"><table cellpadding="1" style="font-weight: bold;">
        

        <tr><td class="topmenu" onclick="location=\'index.php\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:8%;">Home</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'index.php?p=theme\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:30%;">Theme</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'phonem.oft\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:55%;">Phone message</div></td></tr>
        <tr><td class="topmenu" onclick="location=\'Logout.php\'"><img src="img/menutd.png"><div style="position:absolute; left:5%; top:80%;">Logout</div></td></tr>

        
    </table></div>';
?>